package constant.milk.periodapp.util;

import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;

public class MilkShared
{
	private static final String FIRST_FLAG = "FIRST_FLAG";
	private static final String PASSWORD = "PASSWORD";
	private static final String ALARM = "ALARM";
	private static final String SENGRI_DATE = "SENGRI_DATE";
	private static final String SENGRI_TERM = "SENGRI_TERM";
	private static final String SENGRI_TYPE = "SENGRI_TYPE";
	private static final String GOOGLE_ID = "GOOGLE_ID";
	private static final String COLOR_SENGRI = "COLOR_SENGRI";
	private static final String COLOR_GAIM = "COLOR_GAIM";
	private static final String COLOR_BERAN = "COLOR_BERAN";
	private static final String COLOR_SEX = "COLOR_SEX";
	private static final String COLOR_MEMO = "COLOR_MEMO";
	private static final String COLOR_LINE = "COLOR_LINE";
	private static final String COLOR_TODAY = "COLOR_TODAY";
	
	private SharedPreferences p;
	private SharedPreferences.Editor e;
	
	public MilkShared(Context context)
	{
		this.p = context.getSharedPreferences("pref", Activity.MODE_PRIVATE);
		this.e = p.edit();
	}
	
	public int getFirst()
	{
		return p.getInt(FIRST_FLAG, 0);
	}
	
	public void setFirst(int count)
	{
		e.putInt(FIRST_FLAG, count);
		e.commit();
	}
	
	public String getPassword()
	{
		return p.getString(PASSWORD, "");
	}
	
	public void setPassword(String password)
	{
		e.putString(PASSWORD, password);
		e.commit();
	}
	
	public int getAlarm()
	{
		return p.getInt(ALARM, 0);
	}
	
	public void setAlarm(int alarm)
	{
		e.putInt(ALARM, alarm);
		e.commit();
	}
	
	public int getSengriDate()
	{
		return p.getInt(SENGRI_DATE, 5);
	}
	
	public void setSengriDate(int count)
	{
		e.putInt(SENGRI_DATE, count);
		e.commit();
	}
	
	public int getSengriTerm()
	{
		return p.getInt(SENGRI_TERM, 30);
	}
	
	public void setSengriTerm(int count)
	{
		e.putInt(SENGRI_TERM, count);
		e.commit();
	}
	
	public int getSengriType()
	{
		return p.getInt(SENGRI_TYPE, 1);
	}
	
	public void setSengriType(int type)
	{
		e.putInt(SENGRI_TYPE, type);
		e.commit();
	}
	
	public String getGoogleId()
	{
		return p.getString(GOOGLE_ID, "");
	}
	
	public void setGoogleId(String googleId)
	{
		e.putString(GOOGLE_ID, googleId);
		e.commit();
	}
	
	public String getColorSengri()
	{
		return p.getString(COLOR_SENGRI, "#f3a9aa");
	}
	
	public void setColorSengri(String color)
	{
		e.putString(COLOR_SENGRI, color);
		e.commit();
	}
	
	public String getColorGaim()
	{
		return p.getString(COLOR_GAIM, "#2ea7e0");
	}
	
	public void setColorGaim(String color)
	{
		e.putString(COLOR_GAIM, color);
		e.commit();
	}
	
	public String getColorBeran()
	{
		return p.getString(COLOR_BERAN, "#009944");
	}
	
	public void setColorBeran(String color)
	{
		e.putString(COLOR_BERAN, color);
		e.commit();
	}
	
	public String getColorSex()
	{
		return p.getString(COLOR_SEX, "#f8e183");
	}
	
	public void setColorSex(String color)
	{
		e.putString(COLOR_SEX, color);
		e.commit();
	}
	
	public String getColorMemo()
	{
		return p.getString(COLOR_MEMO, "#b0afd7");
	}
	
	public void setColorMemo(String color)
	{
		e.putString(COLOR_LINE, color);
		e.commit();
	}
	
	public String getColorLine()
	{
		return p.getString(COLOR_LINE, "#c4caca");
	}
	
	public void setColorLine(String color)
	{
		e.putString(COLOR_LINE, color);
		e.commit();
	}
	
	public String getColorToday()
	{
		return p.getString(COLOR_TODAY, "#c4caca");
	}
	
	public void setColorToday(String color)
	{
		e.putString(COLOR_TODAY, color);
		e.commit();
	}
	
	public void removeAll()
	{
		e.remove(FIRST_FLAG);
		e.remove(PASSWORD);
		e.remove(ALARM);
		e.remove(SENGRI_DATE);
		e.remove(SENGRI_TERM);
		e.remove(SENGRI_TYPE);
		e.remove(GOOGLE_ID);
		e.remove(COLOR_SENGRI);
		e.remove(COLOR_GAIM);
		e.remove(COLOR_BERAN);
		e.remove(COLOR_SEX);
		e.remove(COLOR_MEMO);
		e.remove(COLOR_LINE);
		e.remove(COLOR_TODAY);
		e.commit();
	}
	
	public void removeColor()
	{
		e.remove(COLOR_SENGRI);
		e.remove(COLOR_GAIM);
		e.remove(COLOR_BERAN);
		e.remove(COLOR_SEX);
		e.remove(COLOR_MEMO);
		e.remove(COLOR_LINE);
		e.remove(COLOR_TODAY);
		e.commit();
	}
}
